import Vue from 'vue'

Vue.filter('transfulltime', function (value) {
    if (!value) return ''
    if(Date.parse(value)){
        var date = new Date(Date.parse(value) + 8 * 3600 * 1000)
        return date.toJSON().substr(0, 19).replace('T', ' ')
    }
})

Vue.filter('transday', function (value) {
    if (!value) return ''
    if(Date.parse(value)){
        var date = new Date(Date.parse(value) + 8 * 3600 * 1000)
        return date.toJSON().substr(0, 10)
    }
})

Vue.filter('transtime', function (value) {
    if (!value) return ''
    if(Date.parse(value)){
        var date = new Date(Date.parse(value) + 8 * 3600 * 1000)
        return date.toJSON().substr(11, 8)
    }
})

Vue.filter('transpath1', function (value) {
    if (!value) return ''
    const str = '观点记录片人物猎奇'
    const i = str.indexOf(value)
    switch (i){
        case 0: return "viewpoint";
        case 2: return "documentary";
        case 5: return "personage";
        case 7: return "curiosity";
        case -1: return "other";
    }
})
Vue.filter('transpath2', function (value1, value2) {
    if (!value1 || !value2) return ''
    const str = '观点记录片人物猎奇'
    const i = str.indexOf(value1)
    switch (i){
        case 0: return "viewpoint/" + value2;
        case 2: return "documentary/" + value2;
        case 5: return "personage/" + value2;
        case 7: return "curiosity/" + value2;
        case -1: return "other/" + value2;
    }
})